﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using Microsoft.Windows.Controls;
using System.Data;

namespace BaocaoNPC.Usercontrols
{
    /// <summary>
    /// Interaction logic for DS_Pop_Timkiem_KH.xaml
    /// </summary>

    public partial class DS_Pop_Timkiem_KH : UserControl
    {
        private Popup pControl;
        public DS_Pop_Timkiem_KH()
        {
            InitializeComponent();
        }
        public String ID_MaKH
        {
            get
            {
                return txtID_MaKH2.Text.Trim();
            }
            set
            {
                txtID_MaKH2.Text = value;
            }
        }
        private DataGrid dgrdsthutien = new DataGrid();
        public DS_Pop_Timkiem_KH(Popup pp, DataGrid dgr, string lbldktimkiem)
        {
            try
            {
                InitializeComponent();
                labelID_KH.Content = lbldktimkiem;
                dgrdsthutien = dgr;
                pControl = pp;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

        }

        private void btnThoat_Click(object sender, RoutedEventArgs e)
        {
            pControl.IsOpen = false;
        }

        private void txtID_MaKH2_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Enter)
                {
                    btnDongY_Click(sender, e);
                }
            }
            catch
            { }
        }

        private void btnDongY_Click(object sender, RoutedEventArgs e)
        {
            int rowIndex = -1;
            DataView dv = dgrdsthutien.ItemsSource as DataView;
            foreach (DataRowView drv in dv)
            {
               
            }
            
            DataRowView drv = dgrdsthutien.SelectedItem as DataRowView;

        }

    }
}
